home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Can main() function be called?
- Date: Tue, 06 Feb 96 15:17:30 GMT
- Organization: none
- Message-ID: <823619850snz@genesis.demon.co.uk>
- References: <823183263.118@fountain.demon.co.uk> <4f1mv0$2fd@cloner4.netcom.com> <4f6n77$e53@library.erc.clarkson.edu>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <4f6n77$e53@library.erc.clarkson.edu>
- koglerje@craft.camp.clarkson.edu "Mountain (jimbo" writes:
-
- >Mike Rosenblyum (rozen@ix.netcom.com) wrote:
- >: I think that it cannot be done, I see no reasonalbe way how main()
- >: could be called more than once.
- >
- >
- >: What is your thoughts on this?
- >
- >
- >Sure you can call main() again, well kindof, just uses setjmp()
- >and longjmp() just put a setjump() call inside main() like:
- >
- >int main()
- >{
- > setjmp(jmp_buf hi);
- > ..
- >}
-
- However that isn't calling main, it is simply returning to an existing
- invocation of it. You can call main with a normal function call such as
-
- main();
-
- in your program. That is perfectly legal and well defined by the C language.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-